package rp.lee.musicplayer.core;

import java.util.ArrayList;
import java.util.List;

import rp.lee.musicplayer.PlayItemsActivity;

import android.app.Activity;

public class ActivityManager {

	public static List<Activity> list = new ArrayList<Activity>(4);
	
	public static synchronized void add(Activity act) {
		list.add(act);
	}

	public static synchronized void exit() {
		/*Iterator<Activity> it = list.iterator();
		while (it.hasNext()) {
			Activity act = it.next();
			act.finish();
			it.remove();
		}*/
		for (Activity act : list) {
			if(act instanceof PlayItemsActivity) {
				((PlayItemsActivity) act)._onExit();
			}
		}
		list.clear();
	}
	
}